#include<stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <iostream>

typedef int ElemType;

void InsertSort(ElemType A[], int n){
    int i,j;
    for(i=2;i<=n;i++){
        if(A[i]<A[i-1]){
            A[0]=A[i];
            for(j=i-1;A[0]<A[j];--j){
                A[j+1]=A[j];
            }
            A[j+1]=A[0];
        }
    }
}

int main(){
    ElemType A[9] = {0, 49, 38, 65, 97, 76, 13, 27, 49};
    InsertSort(A, 9);
    for (int i = 0; i < 8; i++)
    {
        printf("%d : ", A[i]);
    }
    printf("\n");
    system("pause");
    return 0;
}